<template>
	<view class="app">

		<view v-if="seen" class="hao">
			
			
			<!-- <view @click="navTo(`/pages/message/dialogue?id=${item.id}`)" class="center" > -->
			<view  v-for="(item,index) in list" :key="index" @click="navTo(`/pages/message/dialogue?id=${item.id}`)" class="center" >
				<view class="mfzx row center">
					<view>
						<image class="mfzx-img " :src="item.img"></image>
					</view>

					<view class="tech-z">
						<view class="space-between tech-name-info center">
							<view class="tech-name">{{item.name}}</view>
							<view class="mxfx-wz center">
								{{item.add_time}}
							</view>
						</view>

						<view class="space-between  center ">
							<view v-if="item.chat" class="tech-info">{{item.chat}}</view>
							<view v-if="item.state==1 && item.chat !=null" class="yd"></view>
						</view>

					</view>

				</view>
			</view>


			<!-- <view class="center">
				<view class="mfzx row center">
					<view>
						<image class="mfzx-img " src="/static/images/tu_19.png"></image>
					</view>

					<view class="tech-z">
						<view class="space-between tech-name-info center">
							<view class="tech-name">郝紫华</view>
							<view class="mxfx-wz center">
								18:42
							</view>
						</view>

						<view class="space-between  center ">
							<view class="tech-info">医学博士，硕士研导现副硕士研...</view>
							<view class="yd"></view>
						</view>

					</view>

				</view>
			</view> -->

			

		</view>
		<wu-list v-else></wu-list>
	</view>
</template>

<script>
	import wuList from "./wumessage.vue"
	import api from '@/api/commonc.js'
	export default {
		components: {
			wuList
		},
		onLoad() {
			this.messageList()
		},
		data() {
			return {
				seen: false,
				list:[]
			}
		},
		methods: {
			async messageList() {
				const openid = uni.getStorageSync('openid')
				const {
					code,
					data
				} = await api.messageList({
					openid: openid
				})
				
				if (code == -1) {
					uni.showModal({
						content: '请登录！',
						showCancel: false,
						success: () => {
							this.navTo(`/pages/auth/login`);
						}
					});
				}
				// console.log(data)
				if(data.length>0){
					
					this.seen= true
					this.list= data
				}
				
			},
		}
	}
</script>

<style lang="scss">
	.mfzx {

		margin-top: 50rpx;
		width: 690rpx;
		height: 180rpx;
		background: #FFFFFF;
		// box-shadow: 0px 2rpx 31rpx 1rpx rgba(227, 225, 229, 0.4);
		border-radius: 20rpx;

		.mfzx-img {
			height: 120rpx;
			width: 120rpx;
			margin-left: 30rpx;
			border-radius: 50%;

		}

		.tech-z {
			padding-top: 30rpx;
			// background-color: #009926;
			height: 120rpx;
			width: 481rpx;
			margin-left: 30rpx;
			padding-bottom: 120rpx;
			border-bottom: 1rpx solid #EEEEEE;

		}

		.tech-name-info {
			padding-bottom: 8rpx;

			// height: 120rpx;
			// width: 481rpx;
			// background-color: #005CC5;
			.tech-name {
				width: 98rpx;
				height: 35rpx;
				font-size: 32rpx;
				font-family: Microsoft YaHei;
				font-weight: bold;
				line-height: 35rpx;
				color: #333333;

			}

			.mxfx-wz {
				// background-color: red;

				height: 20rpx;
				font-size: 24rpx;
				font-family: Microsoft YaHei;
				font-weight: 400;
				color: #999999;
				line-height: 20rpx;
				text-align: center;


			}

		}

		.tech-info {
			margin-top: 18rpx;
			width: 486rrpx;
			height: 27px;
			font-size: 26rpx;
			font-family: Microsoft YaHei;
			font-weight: 400;
			color: #999999;
			line-height: 27rpx;
			// background-color: #005CC5;
		}

		.yd {
			width: 28rpx;
			height: 15rpx;
			background: #FB5235;
			border-radius: 50%;
			margin-right: 20rpx;
		}
	}
</style>
